var gallery = new Viewer(document.getElementById('viewer'));

$('.container').click(function () {
  // View a list of images
  gallery.show();
})

$('#op').click(function () {
  history.pushState({ state: 1 }, '', '/viewer.html?state=1');

  window.location.href = '/aggrid.html';
})

if (getQueryVariable('state') == 1) {
  console.log(111)
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i = 0; i < vars.length; i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) { return pair[1]; }
  }
  return (false);
}